﻿using UnityEngine;
using System.Collections;

public class Background: MonoBehaviour {

	public float velDown;

	private float seg;
	public Transform trans;

	// Use this for initialization
	void Start () {
		trans = GetComponent<Transform> ();
	}
	
	// Update is called once per frame
	void Update ()
	{
		seg -= Time.deltaTime;
		
		if(trans.position.y <= -6)
		{
			trans.position = new Vector3(0, 0, 0);
		}else if(seg <= 0)
		{
			trans.Translate (new Vector3 (0, -velDown, 0));
			seg = 0.08f;
		}
	}
}
